home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr25 / jmos2_03.zip / MAKEBOOT.CMD < prev   
OS/2 REXX Batch file  |  1993-03-09  |  11KB  |  313 lines

  1. /*     MAKEBOOT.CMD     version 1.00        Donald L. Meyer    */
  2.  
  3. /* This REXX program is designed to create a bootable OS/2 floppy disk    */
  4. /* using both the installation disks and, if possible, files from your OS/2    */
  5. /* directory on the installing machine.  (This speeds things up a bit.)    */
  6.  
  7. /*   This program accepts up to four parameters, which must be in the    */
  8. /* following order:                                */
  9. /*    * type of machine for the boot disk     2=PS/2    1=IBM Compat.    */
  10. /*    * Drive to install on       (A:, B:, ..)     ***Required parameter    */
  11. /*    * Drive to look for OS/2 drivers, etc. besides INSTALLATION disks.    */
  12. /*    * "RECON" tells program to skip main install, and only do optional    */
  13. /*        installation of things like HPFS.IFS, SCSI support, etc.    */
  14. /*        (One limitation is HPFS.IFS will not fit on 1.2mb disks)    */
  15.  
  16. /*  Thanks go out to Morton Kaplon  (73457,437 @ Compuserve)  for    */
  17. /*  doing the legwork determining which files/drivers were/weren't necessary.    */
  18.  
  19. /* Please send any bug reports or suggestions to:                */
  20. /*  internet:    dlmeyer@uiuc.edu                        */
  21.  
  22. version=1.00
  23. '@ECHO OFF'
  24. PARSE Arg all_args
  25. /*  Initializations */
  26. i=1
  27. type=''
  28. ReConfig=0
  29.  
  30. /*   Check for special boot disk mode; PS/2 or Non-PS/2  (2,1) */
  31. IF (word(all_args,i)=='1') |  (word(all_args,i)=='2') THEN DO 1
  32.    type=word(all_args,i)
  33.    i = i + 1
  34. END
  35. ELSE NOP
  36.  
  37. /* If not Target drive specified, exit with Syntax description. */
  38. IF word(all_args,i)=='' THEN DO 1
  39.    SAY 'Syntax:   MAKEBOOT {m} d1: {d2:} {RECON}'
  40.    SAY '    [m:  = Machine type: PS/2=2   Non-PS/2=1   *Optional]'
  41.    SAY '    [d1: = floppy drive to make bootdisk in.    *Required]'
  42.    SAY '    [d2: = hard drive with OS/2 installed.  *Optional]'
  43.    SAY '    [RECON = Reconfigure existing boot disk.  *Optional]'
  44.    SAY '        (Optional Parameters are assumed to match '
  45.    SAY '         current system configuration if not specified.)'
  46.    EXIT
  47. END
  48. ELSE NOP
  49.     /* Load some advanced functions... */
  50. CALL RxFuncAdd 'SysCurPos', 'RexxUtil', 'SysCurPos'
  51. CALL RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'
  52. CALL RxFuncAdd 'SysDriveMap', 'RexxUtil', 'SysDriveMap'
  53. CALL RxFuncAdd 'SysDriveInfo', 'RexxUtil', 'SysDriveInfo'
  54. CALL RxFuncAdd 'SysTextScreenRead', 'RexxUtil', 'SysTextScreenRead'
  55.  
  56.     /* Finish setting up operating parameters...  */
  57. instto=word(all_args,i)
  58. i=i+1
  59. instfrom=word(all_args,i)
  60. IF (instfrom=='RECON') | (instfrom=='recon') THEN DO 1
  61.    ReConfig=1
  62.    instfrom=''
  63. END
  64. ELSE IF (word(all_args,i+1)=='RECON') | (word(all_args,i+1)=='recon') THEN ReConfig=1
  65. IF instfrom=='' THEN DO 1
  66.    DriveMap=SysDriveMap('C:', 'LOCAL')
  67.    DO i=1 to Words(DriveMap)
  68.       k=SysFileTree(Word(DriveMap,i)'\OS2\HELP.CMD', 'file',,)
  69.       IF (file.0==1) THEN instfrom=Word(DriveMap,i)
  70.    END
  71. END
  72. ELSE NOP
  73. IF type=='' THEN DO 1
  74.    type=2        /* Assume PS/2 unless proven incorrect. */
  75.    /*   Check if above assumption correct... */
  76.    i=SysFileTree(instfrom'\OS2\KBD01.SYS', 'file',,)
  77.    IF (file.0==1) THEN type=1
  78.    DROP file
  79. END
  80. ELSE NOP
  81.  
  82.     /* Here we go ..... */
  83. 'CLS'
  84. SAY 'Creating an OS/2 v2.0 Boot Diskette on drive 'instto', from drive 'instfrom'.'
  85. SAY '                                    (v'version')'
  86.  
  87. /* Establish File Lists now that install type has been established.  */
  88. dll_list='ANSICALL BKSCALLS BMSCALLS BVSCALLS BVHINIT DOSCALL1 KBDCALLS MOUCALLS MSG NAMPIPES NLS OS2CHAR QUECALLS SESMGR VIOCALLS'
  89. sys_list='PRINT0'type' KBD0'type' DOS CLOCK0'type' SCREEN0'type
  90. misclist='IBM'type'FLPY.ADD IBMINT13.I13 OS2DASD.DMD INSTALL\SYSLEVEL.OS2 CMD.EXE'
  91. filelist2 = 'HARDERR.EXE SYSINST1.EXE KEYBOARD.DCP COUNTRY.SYS'
  92.  
  93. IF (ReConfig==0) THEN DO 1
  94.   'MD 'instfrom'\OS2\INSTALL\TEMP'
  95.   SAY
  96.   k=0
  97.   DO WHILE k==0
  98.      CALL BEEP 392, 250
  99.      SAY 'Insert OS/2 INSTALLATION DISK in drive 'instto'.'
  100.      'PAUSE'
  101.      SAY
  102.      k=SysFileTree(instto'\SYSINSTX.COM', 'file',,)
  103.      k=file.0
  104.   END
  105.   filelist1 = 'OS2KRNL* OS2LDR SYSINSTX.COM'
  106.  
  107.   k=SysCurPos()
  108.   SAY 'Copying necessary files from drive 'instto' .'
  109.   DO i=1 TO WORDS(filelist1)
  110.      CALL SysCurPos word(k,1), 38+i
  111.      COPY instto'\'WORD( filelist1, i)' 'instfrom'\OS2\INSTALL\TEMP >nul'
  112.      SAY '.'
  113.   END
  114.   'REN 'instfrom'\OS2\INSTALL\TEMP\OS2KRNL* OS2KRNL'
  115.   k=1
  116.   DO WHILE k==1
  117.      SAY
  118.      CALL BEEP 392, 250
  119.      SAY 'Insert OS/2 BOOT DISK [To Be Created] in drive 'instto'.'
  120.      'PAUSE'
  121.      k=SysFileTree(instto'\SYSINSTX.COM', 'file',,)
  122.      k=file.0
  123.   END
  124.   filelist1 = 'OS2\INSTALL\TEMP\OS2KRNL OS2\INSTALL\TEMP\OS2LDR OS2LDR.MSG'
  125.   SAY
  126.   k=SysCurPos()
  127.   SAY 'Installing Files on new BOOT DISKETTE .'
  128.   CALL SysCurPos word(k,1), 39
  129.   instfrom'\OS2\INSTALL\TEMP\SYSINSTX 'instto' >nul'
  130.   SAY '.'
  131.   DO i=1 TO WORDS(filelist1)
  132.      CALL SysCurPos word(k,1), 39+i
  133.      COPY instfrom'\'WORD( filelist1,i)' 'instto'\ >nul'
  134.      SAY '.'
  135.   END
  136.   'ECHO Y | DEL 'instfrom'\OS2\INSTALL\TEMP >nul'
  137.  
  138.   k=SysCurPos()
  139.   SAY 'Installing DLLs .'
  140.   DO i=1 TO WORDS(dll_list)
  141.      COPY instfrom'\OS2\DLL\'WORD(dll_list,i)'.DLL 'instto'\ >nul'
  142.      ERR = SysTextScreenRead(word(k,1)+1,0,7)
  143.      CALL SysCurPos word(k,1)+1, 0
  144.      SAY '                            '
  145.     /* If not found, then install is cross-type -- add to files to get from DISK 1.  */
  146.      IF (ERR=='SYS0002') THEN DO 1
  147.         filelist2=filelist2' 'WORD(dll_list,i)'.DLL'
  148.      END
  149.      CALL SysCurPos word(k,1), 16+i
  150.      SAY .
  151.   END
  152.   k=SysCurPos()
  153.   SAY 'Installing SYSs .'
  154.   DO i=1 TO WORDS(sys_list)
  155.      COPY instfrom'\OS2\'WORD(sys_list,i)'.SYS 'instto'\ >nul'
  156.      ERR = SysTextScreenRead(word(k,1)+1,0,7)
  157.      CALL SysCurPos word(k,1)+1, 0
  158.      SAY '                            '
  159.      IF (ERR=='SYS0002') THEN DO 1
  160.         filelist2=filelist2' 'WORD(sys_list,i)'.SYS'
  161.      END
  162.      CALL SysCurPos word(k,1), 16+i
  163.      SAY .
  164.   END
  165.   k=SysCurPos()
  166.   SAY 'Installing misc .'
  167.   DO i=1 TO WORDS(misclist)
  168.      COPY instfrom'\OS2\'WORD( misclist, i)' 'instto'\ >nul'
  169.      ERR = SysTextScreenRead(word(k,1)+1,0,7)
  170.      CALL SysCurPos word(k,1)+1, 0
  171.      SAY '                            '
  172.      IF (ERR=='SYS0002') THEN DO 1
  173.         filelist2=filelist2' 'WORD(misclist,i)
  174.      END
  175.      CALL SysCurPos word(k,1), 16+i
  176.      SAY .
  177.   END
  178.   
  179.   DROP dll_list
  180.   DROP sys_list
  181.   DROP misclist
  182.   k=0
  183.   DO WHILE k==0
  184.      SAY
  185.      SAY 'Insert OS/2 DISKETTE 1 in drive 'instto'.'
  186.      CALL BEEP 392, 250
  187.      'PAUSE'
  188.      k=SysFileTree(instto'\FDISK.COM', 'file',,)
  189.      k=file.0
  190.   END
  191.   SAY
  192.   k=SysCurPos()
  193.   SAY 'Copying Files from OS/2 DISKETTE 1.'
  194.   IF (type==1) THEN filelist2=filelist2' IBM'type'S506.ADD'
  195.   DO i=1 TO WORDS(filelist2)
  196.      CALL SysCurPos word(k,1), 34+i
  197.      COPY instto'\'WORD(filelist2,i)' 'instfrom'\OS2\INSTALL\TEMP >nul'
  198.      SAY .
  199.   END
  200.   k=1
  201.   j=0
  202.   DO WHILE (k>0) | (j==0)
  203.      SAY
  204.      SAY 'Re-Insert the new OS/2 BOOT DISK in drive 'instto'.'
  205.      CALL BEEP 392, 250
  206.      'PAUSE'
  207.      j=SysFileTree(instto'\CMD.EXE', 'file',,)    /* Check presence of files to verify correct disk.  */
  208.      j=file.0
  209.      k=SysFileTree(instto'\*.BIO', 'file',,)
  210.      k=file.0
  211.   END
  212.   SAY
  213.   SAY 'Copying Files to new BOOT DISKETTE .'
  214.   k=SysCurPos()
  215.   DO i=1 TO WORDS(filelist2)
  216.      CALL SysCurPos word(k,1)-1, 35+i
  217.      COPY instfrom'\OS2\INSTALL\TEMP\'WORD(filelist2,i)' 'instto'\ >nul'
  218.      SAY .
  219.   END
  220.   'ECHO Y | DEL 'instfrom'\OS2\INSTALL\TEMP >nul'
  221.   'RD 'instfrom'\OS2\INSTALL\TEMP'
  222.   IF type==2 THEN DO 1    /* Create ABIOS.SYS if a PS/2 boot disk.  */
  223.      abios_file=instto'\ABIOS.SYS'
  224.      CALL lineout abios_file, '', 1
  225.      k=lineout(abios_file)
  226.      DROP abios_file
  227.      SAY 'ABIOS.SYS Created on drive 'instto'.'
  228.      SAY
  229.   END
  230. END
  231. /*   The Optionals Area  */
  232. 'CLS'
  233. SAY
  234. k=SysCurPos()
  235. DriveInfo=SysDriveInfo(instto)
  236. file = SysFileTree(instto'\NPXEMLTR.DLL', 'file',,)
  237. IF (word(DriveInfo,2)<25280) & (file.0==0) THEN DO 1
  238.    SAY ' There isn''t enough space to install coprocessor emulator...'
  239.    SAY
  240. END
  241. ELSE DO 1
  242.    SAY ' Will this disk be used on machines without math coprocessors?  [Y/N]'
  243.    i=SysCurPos(word(k,1),72)
  244.    PULL nomath
  245. END
  246. k=SysCurPos()
  247. file = SysFileTree(instto'\OS2SCSI.DMD', 'file',,)
  248. IF (word(DriveInfo,2) < 10462 + ((nomath=='Y')*25280)) & (file.0==0) THEN DO 1
  249.    SAY ' There isn''t enough space to install the SCSI Driver...'
  250.    SAY
  251. END
  252. ELSE DO 1
  253.    SAY ' Will you need the SCSI Driver installed?  [Y/N]'
  254.    i=SysCurPos(word(k,1),50)
  255.    PULL scsi
  256. END
  257. k=SysCurPos()
  258. file = SysFileTree(instto'\HPFS.IFS', 'file',,)
  259. IF (word(DriveInfo,2)<125466 + ((nomath=='Y') * 25280) + ((scsi=='Y') * 10462)) & (file.0==0) THEN DO 1
  260.    SAY ' There isn''t enough space to install the HPFS File System...'
  261.    SAY
  262. END
  263. ELSE DO 1
  264.    SAY ' Will you need the HPFS File System?  [Y/N]'
  265.    i=SysCurPos(word(k,1),50)
  266.    PULL hpfs
  267. END
  268. SAY
  269. k=SysCurPos()
  270. SAY 'Copying Optional Files.'
  271. CALL SysCurPos word(k,1), 22+(scsi=='Y')
  272. IF (scsi=='Y') THEN COPY instfrom'\OS2\OS2SCSI.DMD 'instto'\ >nul'
  273. SAY '.'
  274. CALL SysCurPos word(k,1), 22+(scsi=='Y')+(hpfs=='Y')
  275. IF (hpfs=='Y') THEN COPY instfrom'\OS2\HPFS.IFS 'instto'\ >nul'
  276. SAY '.'
  277. CALL SysCurPos word(k,1), 22+(scsi=='Y')+(hpfs=='Y')+(nomath=='Y')
  278. IF (nomath=='Y') THEN COPY instfrom'\OS2\DLL\NPXEMLTR.DLL 'instto'\ >nul'
  279. SAY '.'
  280.  
  281. /* Create the Config.Sys dynamically...   */
  282. SAY 'Creating CONFIG.SYS on drive 'instto'...'
  283. config_file=instto'\CONFIG.SYS'
  284. CALL lineout config_file, 'IFS=HPFS.IFS /CACHE:64', 1
  285. CALL lineout config_file, 'BUFFERS=32'
  286. CALL lineout config_file, 'IOPL=YES'
  287. CALL lineout config_file, 'MEMMAN=NOSWAP'
  288. CALL lineout config_file, 'PROTSHELL=SYSINST1.EXE'
  289. CALL lineout config_file, 'SET OS2_SHELL=CMD.EXE'
  290. CALL lineout config_file, 'DISKCACHE=64,LW'
  291. CALL lineout config_file, 'PROTECTONLY=YES'
  292. CALL lineout config_file, 'LIBPATH=.;\;'
  293. CALL lineout config_file, 'PAUSEONERROR=NO'
  294. CALL lineout config_file, 'CODEPAGE=850'
  295. CALL lineout config_file, 'DEVINFO=KBD,US,KEYBOARD.DCP'
  296. CALL lineout config_file, 'REM DEVINFO=SCR,EGA,VTBL850.DCP'
  297. CALL lineout config_file, 'DEVICE=\DOS.SYS'
  298. CALL lineout config_file, 'REM DEVICE=\MOUSE.SYS'
  299. CALL lineout config_file, 'SET PATH=.;\'
  300. CALL lineout config_file, 'SET DPATH=\;'
  301. CALL lineout config_file, 'SET KEYS=ON'
  302. CALL lineout config_file, 'BASEDEV=PRINT0'type'.SYS'
  303. CALL lineout config_file, 'BASEDEV=IBM'type'FLPY.ADD'
  304. IF (type==1) THEN CALL lineout config_file, 'BASEDEV=IBM1S506.ADD'
  305. IF (scsi=='Y') THEN CALL lineout config_file, 'BASEDEV=IBMSCSI.ADD'
  306. CALL lineout config_file, 'BASEDEV=IBMINT13.I13'
  307. CALL lineout config_file, 'BASEDEV=OS2DASD.DMD'
  308. CALL lineout config_file, 'REM DEVICE=\TESTCFG.SYS'
  309. k=lineout(config_file)
  310. DROP config_file
  311. SAY
  312. SAY 'Boot Diskette has been created.'
  313. EXIT